package org.lzfto.flink.demo.business.flinkTest.flinkObjects.connector.file;

import org.apache.flink.table.connector.ChangelogMode;
import org.apache.flink.table.connector.source.DynamicTableSource;
import org.apache.flink.table.connector.source.ScanTableSource;
import org.apache.flink.table.types.DataType;
import org.lzfto.flink.demo.business.flinkTest.base.record.ExcelOptionRecord;

/**
 * 自定义excel table源头
 * @author lzfto
 * @created 2025年6月4日 13:40:35
 */
public class CustExcelTableSource implements ScanTableSource {

	private final ExcelOptionRecord option;
	private final DataType dataType;

	public CustExcelTableSource(ExcelOptionRecord option, DataType dataType) {
		this.option = option;
		this.dataType = dataType;
	}

	@Override
	public DynamicTableSource copy() {
		return new CustExcelTableSource(option, dataType);
	}

	@Override
	public String asSummaryString() {
		return "lzfto's excel to logical table 连接器 ";
	}

	@Override
	public ChangelogMode getChangelogMode() {
		return ChangelogMode.insertOnly();
	}

	@Override
	public ScanRuntimeProvider getScanRuntimeProvider(ScanContext runtimeProviderContext) {
		return new CustExcelFormatProvider(option, dataType);
	}



}
